package com.sky.mapper;

import com.sky.dto.SetmealDTO;
import com.sky.entity.Setmeal;
import com.sky.entity.SetmealDish;
import com.sky.vo.DishItemVO;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface SetmealDishMapper {

    //查询所有关于dish菜品的套餐
    List<SetmealDish> getSetmealByDishIds(List<Long> ids);

    void saveSetmealDishes(List<SetmealDish> setmealDishes);

    @Select("select * from setmeal_dish where setmeal_id = #{id}")
    List<SetmealDish> getSetmealById(Integer id);

    @Delete("delete from setmeal_dish where setmeal_id = #{id}")
    void deleteSetmealDishById(SetmealDTO dto);

    void deleteSetmeals(List<Long> ids);

    //查询关联的所有setmeal的id
    @Select("select setmeal_id from setmeal_dish where dish_id = #{id}")
    List<Long> getSetmealByDishId(Long id);

    @Select("select dish_id from setmeal_dish where setmeal_id = #{id}")
    List<Long> getDishIdsBySetmealId(Long id);

    List<DishItemVO> getDishBySetmealId(Integer id);
}
